#include "mainwindow.h"
#include <QApplication>
#include <iostream>
using namespace std;

class Base
{
public:
    virtual void print() {
        cout << "Base" << endl;
    }

    int aa;
};

class DerivedA : public Base
{
public:
    virtual void print() {
        cout << "DerivedA" << endl;
    }
    char bb;
};

class DerivedB : public Base
{
public:
    virtual void print() {
        cout << "DerivedB" << endl;
    }
    string cc;
};

class Other
{

};

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    DerivedA da;
    Base *pB = static_cast<Base*>(&da);
    pB->print();
    DerivedA *pDA = static_cast<DerivedA*>(pB);
    pDA->print();

    Base b;
    DerivedB *pDAb = dynamic_cast<DerivedB*>(pB);
    pDAb->print();
    pDAb->cc = 30;

    return a.exec();
}
